﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AllUsersList.aspx.cs" Inherits="IBMS.Page.AllUsersList" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link rel="stylesheet" type="text/css" href="../../Styles/css.css" />
    <script src="../../Scripts/lk.js"></script>
    <script src="../Scripts/jquery-1.8.2.min.js"></script>
    <script src="../Scripts/prefixfree.min.js"></script>
    <script src="../Scripts/index.js"></script>
    <link href="../../Styles/lk.css" rel="stylesheet" type="text/css" />
</head>
<body> 
    <form id="form1" runat="server">
    <div class="login_box" style="margin-left:170px;margin-top:50px;">
     <asp:ListView ID="ListView1" runat="server" DataKeyNames="ID" DataSourceID="SqlDataSource1" OnItemCommand="ListView1_ItemCommand">
              <AlternatingItemTemplate>
                  <tr style="background-color:#FFF8DC;" >
                      <td>
                          <asp:Button ID="DeleteButton" runat="server" CommandName="MyDelete" Text="修改" />
                      </td>
                      <td>
                          <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                      </td>
                      <td>
                          <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                      </td>
                      <td>
                          <asp:Label ID="RealNameLabel" runat="server" Text='<%# Eval("RealName") %>' />
                      </td>
                      <td>
                          <asp:Label ID="PasswordLabel" runat="server" Text='<%# Eval("Password") %>' />
                      </td>
                      <td>
                          <asp:Label ID="UserTypeLabel" runat="server" Text='<%# Eval("UserType") %>' />
                      </td>
                      <td>
                          <asp:Label ID="ProjectIdLabel" runat="server" Text='<%# Eval("ProjectId") %>' />
                      </td>
                  </tr>
              </AlternatingItemTemplate>
              <EditItemTemplate >
                  <tr style="background-color:#008A8C;color: #FFFFFF;">
                      <td>
                          <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="更新" />
                          <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="取消" />
                      </td>
                      <td>
                          <asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />
                      </td>
                      <td>
                          <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
                      </td>
                      <td>
                          <asp:TextBox ID="RealNameTextBox" runat="server" Text='<%# Bind("RealName") %>' />
                      </td>
                      <td>
                          <asp:TextBox ID="PasswordTextBox" runat="server" Text='<%# Bind("Password") %>' />
                      </td>
                      <td>
                          <asp:TextBox ID="UserTypeTextBox" runat="server" Text='<%# Bind("UserType") %>' />
                      </td>
                      <td>
                          <asp:TextBox ID="ProjectIdTextBox" runat="server" Text='<%# Bind("ProjectId") %>' />
                      </td>
                  </tr>
              </EditItemTemplate>
              <EmptyDataTemplate>
                  <table runat="server" style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                      <tr>
                          <td>未返回数据。</td>
                      </tr>
                  </table>
              </EmptyDataTemplate>
              <InsertItemTemplate>
                  <tr style="">
                      <td>
                          <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="插入" />
                          <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="清除" />
                      </td>
                      <td>&nbsp;</td>
                      <td>
                          <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
                      </td>
                      <td>
                          <asp:TextBox ID="RealNameTextBox" runat="server" Text='<%# Bind("RealName") %>' />
                      </td>
                      <td>
                          <asp:TextBox ID="PasswordTextBox" runat="server" Text='<%# Bind("Password") %>' />
                      </td>
                      <td>
                          <asp:TextBox ID="UserTypeTextBox" runat="server" Text='<%# Bind("UserType") %>' />
                      </td>
                      <td>
                          <asp:TextBox ID="ProjectIdTextBox" runat="server" Text='<%# Bind("ProjectId") %>' />
                      </td>
                  </tr>
              </InsertItemTemplate>
              <ItemTemplate>
                  <tr style="background-color:#DCDCDC;color: #000000;">
                      <td>
                          <asp:Button ID="DeleteButton" runat="server" CommandName="MyDelete" Text="修改" />
                      </td>
                      <td>
                          <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                      </td>
                      <td>
                          <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                      </td>
                      <td>
                          <asp:Label ID="RealNameLabel" runat="server" Text='<%# Eval("RealName") %>' />
                      </td>
                      <td>
                          <asp:Label ID="PasswordLabel" runat="server" Text='<%# Eval("Password") %>' />
                      </td>
                      <td>
                          <asp:Label ID="UserTypeLabel" runat="server" Text='<%# Eval("UserType") %>' />
                      </td>
                      <td>
                          <asp:Label ID="ProjectIdLabel" runat="server" Text='<%# Eval("ProjectId") %>' />
                      </td>
                  </tr>
              </ItemTemplate>
              <LayoutTemplate>
                  <table runat="server">
                      <tr runat="server">
                          <td runat="server">
                              <table id="itemPlaceholderContainer" runat="server" border="1" style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                                  <tr runat="server" style="background-color:#DCDCDC;color: #000000;">
                                      <th runat="server" style="width:100px;height:auto"></th>
                                      <th runat="server" style="width:100px;height:auto">ID</th>
                                      <th runat="server" style="width:100px;height:auto">Name</th>
                                      <th runat="server" style="width:100px;height:auto">RealName</th>
                                      <th runat="server" style="width:100px;height:auto">Password</th>
                                      <th runat="server" style="width:100px;height:auto">UserType</th>
                                      <th runat="server" style="width:100px;height:auto">ProjectId</th>
                                  </tr>
                                  <tr id="itemPlaceholder" runat="server">
                                  </tr>
                              </table>
                          </td>
                      </tr>
                      <tr runat="server">
                          <td runat="server" style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;"></td>
                      </tr>
                  </table>
              </LayoutTemplate>
              <SelectedItemTemplate>
                  <tr style="background-color:#008A8C;font-weight: bold;color: #FFFFFF;">
                      <td>
                          <asp:Button ID="DeleteButton" runat="server" CommandName="MyDelete" Text="修改" />
                      </td>
                      <td>
                          <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                      </td>
                      <td>
                          <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                      </td>
                      <td>
                          <asp:Label ID="RealNameLabel" runat="server" Text='<%# Eval("RealName") %>' />
                      </td>
                      <td>
                          <asp:Label ID="PasswordLabel" runat="server" Text='<%# Eval("Password") %>' />
                      </td>
                      <td>
                          <asp:Label ID="UserTypeLabel" runat="server" Text='<%# Eval("UserType") %>' />
                      </td>
                      <td>
                          <asp:Label ID="ProjectIdLabel" runat="server" Text='<%# Eval("ProjectId") %>' />
                      </td>
                  </tr>
              </SelectedItemTemplate>
          </asp:ListView>
          <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:IBMSConnectionString2 %>" DeleteCommand="DELETE FROM [Users] WHERE [ID] = @ID" InsertCommand="INSERT INTO [Users] ([Name], [RealName], [Password], [UserType], [ProjectId]) VALUES (@Name, @RealName, @Password, @UserType, @ProjectId)" SelectCommand="SELECT * FROM [Users]" UpdateCommand="UPDATE [Users] SET [Name] = @Name, [RealName] = @RealName, [Password] = @Password, [UserType] = @UserType, [ProjectId] = @ProjectId WHERE [ID] = @ID">
              <DeleteParameters>
                  <asp:Parameter Name="ID" Type="Int32" />
              </DeleteParameters>
              <InsertParameters>
                  <asp:Parameter Name="Name" Type="String" />
                  <asp:Parameter Name="RealName" Type="String" />
                  <asp:Parameter Name="Password" Type="String" />
                  <asp:Parameter Name="UserType" Type="String" />
                  <asp:Parameter Name="ProjectId" Type="String" />
              </InsertParameters>
              <UpdateParameters>
                  <asp:Parameter Name="Name" Type="String" />
                  <asp:Parameter Name="RealName" Type="String" />
                  <asp:Parameter Name="Password" Type="String" />
                  <asp:Parameter Name="UserType" Type="String" />
                  <asp:Parameter Name="ProjectId" Type="String" />
                  <asp:Parameter Name="ID" Type="Int32" />
              </UpdateParameters>
          </asp:SqlDataSource>
    </div>
    </form>
</body>
</html>
